Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 1 |
1 | import fs from 'fs' |
||
3 | const deleteFolderRecursive = path => { |
||
4 | if (fs.existsSync(path)) { |
||
5 | fs.readdirSync(path).forEach((file) => { |
||
6 | const curPath = `${path}/${file}` |
||
7 | if (fs.lstatSync(curPath).isDirectory()) { |
||
8 | deleteFolderRecursive(curPath) |
||
9 | } else { |
||
10 | fs.unlinkSync(curPath) |
||
11 | } |
||
12 | }) |
||
13 | fs.rmdirSync(path) |
||
14 | } |
||
15 | } |
||
16 | |||
17 | export default deleteFolderRecursive |